package com.example.sbbsec;


import org.elasticsearch.client.Client;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.NodeClientFactoryBean;
import org.springframework.data.elasticsearch.client.TransportClientFactoryBean;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;

import java.util.UUID;

/**
 *
 * @author Arat.Wu
 * @date 2018/11/16
 */
@Configuration
public class ElasticsearchConfig {

    @Bean
    public TransportClientFactoryBean client() {
        TransportClientFactoryBean bean = new TransportClientFactoryBean();
        //bean.setClusterName(UUID.randomUUID().toString());
        //bean.setClientTransportSniff(Boolean.FALSE);
        return bean;
    }
//    @Bean
//    public ElasticsearchOperations elasticsearchTemplate(Client client){
//        return new ElasticsearchTemplate(client);
//    }

}

